package com.example.gxwmvp.presenter;

import com.example.gxwmvp.bean.Girls;
import com.example.gxwmvp.mode.GirlModeInterfaceImp;
import com.example.gxwmvp.mode.IGirlModeInterface;
import com.example.gxwmvp.view.IGirlViewInterface;

import java.lang.ref.WeakReference;
import java.util.List;

public class GirlPresenter <V extends IGirlViewInterface> extends BasePresenter<V>{

    IGirlModeInterface girlMode = new GirlModeInterfaceImp();


    public void fetch()
    {
        if(mWeakRefView.get() != null)
        {
            mWeakRefView.get().showLoading();

            if(girlMode != null)
            {
                girlMode.loadData(new IGirlModeInterface.GirlsLoadListener() {
                    @Override
                    public void complete(List<Girls> girlsList) {

                        if( mWeakRefView.get() != null)
                        {
                            mWeakRefView.get().showList(girlsList);
                        }
                    }
                });
            }
        }

    }

}
